import { useState, useEffect } from 'react'
import { getTopics } from '../api/topics'
const useTopics = ()=>{
    const [topics, setTopics] = useState([])
    useEffect(()=>{
        getTopics()
            .then(res=>{
                setTopics(res.data.data)
            })
    },[])
    const addTopic = (data)=>{  
        // addTopic(data)
        //     .then(res=>{
        //         setTopics([...topics, res.data.data])
        //     })
    }
    return {topics, addTopic}
}   

export default useTopics